package com.lefu.es.constant;

import android.util.Log;

import com.lefu.es.db2.MacDao;
import com.lefu.es.entity.DeviceMacDao;

import java.util.List;

/**
 * 全局数据
 *
 * @author lfl
 */
public class AppData {
    public static String LF_SCALE = "LFScale";

    /**
     * 打开APP是否有测量数据
     */
    public static boolean hasCheckData = false;

    /**
     * 是否重新检测
     */
    public static boolean reCheck = false;

    /**
     * 是否在扫描过程中
     */
    public static boolean isCheckScale = false;
    /**
     * 人体秤页面标识
     */
    public static int BODY_SCALE_NEW_ACTIVITY_FLAG = 1001;
    /**
     * 脂肪秤页面标识
     */
    public static int BODY_FAT_SCALE_NEW_ACTIVITY_FLAG = 1002;

    /**
     * 婴儿秤界面标识
     */
    public static int BABY_SCALE_NEW_ACTIVITY_FLAG = 1003;

    /**
     * 营养秤界面标识
     */
    public static int KITCHEN_SCALE_NEW_ACTIVITY_FLAG = 1004;
    public static boolean checkBindStatus() {
        /***查询数据库集合***/
        List<DeviceMacDao> macArrayList = MacDao.queryAll();
        if (!macArrayList.isEmpty()) {
            for (int i = 0; i <= macArrayList.size(); i++) {
                if (macArrayList.get(i).getMac().equals(macArrayList.get(i).getMac())) {
                    Log.d("AppData", "--当前绑定的mac:" + macArrayList.get(i).getMac());
                    return true;
                } else {
                    Log.d("AppData", "当前没有绑定" + macArrayList.get(i).getMac());
                    return false;
                }
            }
        } else {
            Log.d("AppData", "当前没有绑定");
            return false;
        }
        /*String mac = (String) SPUtil.get(activity, "mac", "");
        Gson gson = new Gson();
		if (TextUtils.isEmpty(mac)) {
			LogUtils.d("AppData", "当前没有绑定");
			return false;
		} else {
			MacEntity macEntity = gson.fromJson(mac, MacEntity.class);
			String mac_address = macEntity.getMac();
			if (macEntity != null && !TextUtils.isEmpty(mac_address)) {
				LogUtils.d("AppUtils", "--当前绑定的mac:" + mac_address);
				return true;
			}
		}*/
        return false;
    }
}
